package com.itheima.service.serviceimpl;

import com.itheima.common.constant.MessageConstant;
import com.itheima.common.entity.Result;
import com.itheima.dao.MemberDao;
import com.itheima.pojo.LoginMes;
import com.itheima.service.MemberService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class MemberServiceImpl implements MemberService {

    @Autowired
    private MemberDao memberDao;
    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    public Result login(LoginMes loginMes) {
        String telephone = loginMes.getTelephone();
        String validateCode = loginMes.getValidateCode();
        if (redisTemplate.opsForValue().get("MesValidateCode")==null){
            return new Result(false, MessageConstant.VALIDATECODE_ERROR);
        }
        return new Result(true, MessageConstant.LOGIN_SUCCESS);
    }


}
